package com.eagle.security.service;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

import com.eagle.security.entries.User;
import com.eagle.security.entries.UserCopy;

public interface UserManageService {
    /**
     * 新增
     * 
     * @param mo
     * @return
     */
    int saveUser(User mo);

    /**
     * 修改
     * 
     * @param mo
     * @return
     * @throws NoSuchMethodException 
     * @throws InvocationTargetException 
     * @throws IllegalAccessException 
     */
    int modifyUser(UserCopy mo) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;

    /**
     * 删除
     * 
     * @param id
     * @return
     */
    int deleteUserByUsername(String username);

    /**
     * find
     * 
     * @param id
     * @return
     */
    User findUserByUsername(String username);

    /**
     * find
     * 
     * @param id
     * @return
     */
    Map<String, Object> findUserMapByUsername(String id);

    /**
     * 根据条件查找
     * 
     * @param mo
     * @param start
     * @param pageSize
     * @return
     */
    List<User> findUsersByCond(User mo, int page, int pageSize);

    /**
     * 根据条件查找
     * 
     * @param mo
     * @param start
     * @param pageSize
     * @return
     */
    List<Map<String, Object>> findUserMapsByCond(User mo, int page, int pageSize);

    /**
     * 根据条件查找总数
     * 
     * @param mo
     * @return
     */
    int findUserCountByCond(User mo);

    /**
     * 新增时，根据指定字段，检查数据库中是否已有记录
     * 
     * @param mo
     * @return
     */
    int checkExistWhenSaveUser(User mo);
}
